#include "Item.hh"
#include <iostream>
#include <random>

Item::Item(std::string name, std::string description, Type type, unsigned value, int level)
    : name(std::move(name)), description(std::move(description)), type(type), value(value), level(level) {}


// 重载输出流操作符
// Overload the output stream operator (<<) to print Item::Type values
std::ostream& operator<<(std::ostream& os, Item::Type type) {
    switch (type) {
        case Item::Type::HealPotion:    os << "Healing Potion"; break;
        case Item::Type::BoostPotion:   os << "Boost Potion"; break;
        case Item::Type::DefencePotion: os << "Defence Potion"; break;
        case Item::Type::Weapon:        os << "Weapon"; break;
        case Item::Type::Armor:         os << "Armor"; break;
        default: os << "Unknown"; break;
    }
    return os;
}


const std::vector<Item>& getAllShopItems() {
    static std::vector<Item> allItems = {
        {"Small Healing Potion", "Restores 20 HP.", Item::Type::HealPotion, 20, 0},
        {"Medium Healing Potion", "Restores 50 HP.", Item::Type::HealPotion, 50, 0},
        {"Large Healing Potion", "Restores 100 HP.", Item::Type::HealPotion, 100, 0},

        {"Small Attacking Potion", "Increase 5 ATK in one round.", Item::Type::BoostPotion, 5, 0},
        {"Medium Attacking Potion", "Increase 10 ATK in one round.", Item::Type::BoostPotion, 10, 0},
        {"Large Attacking Potion", "Increase 20 ATK in one round.", Item::Type::BoostPotion, 20, 0},

        {"Small Defending Potion", "Increase 5 DEF in one round.", Item::Type::DefencePotion, 5, 0},
        {"Medium Defending Potion", "Increase 10 DEF in one round.", Item::Type::DefencePotion, 10, 0},
        {"Large Defending Potion", "Increase 20 DEF in one round.", Item::Type::DefencePotion, 20, 0},

        {"Iron Sword", "Basic sword that adds 10 ATK.", Item::Type::Weapon, 10, 0},
        {"Steel Axe", "Heavy axe that adds 15 ATK.", Item::Type::Weapon, 15, 0},
        {"Elven Dagger", "Light and fast, adds 12 ATK.", Item::Type::Weapon, 12, 0},
        {"Bone Club", "Crude weapon, adds 8 ATK.", Item::Type::Weapon, 8, 0},
        {"Magic Wand", "Adds 14 magical ATK.", Item::Type::Weapon, 14, 0},
        {"Flame Sword", "Adds 18 ATK, deals fire damage.", Item::Type::Weapon, 18, 0},
        {"Thunder Blade", "Adds 20 ATK, chance to stun.", Item::Type::Weapon, 20, 0},
        {"Vampire Fang", "Adds 13 ATK, steals HP on hit.", Item::Type::Weapon, 13, 0},

        {"Leather Armor", "Light armor adds 5 DEF.", Item::Type::Armor, 5, 0},
        {"Chainmail", "Medium armor adds 10 DEF.", Item::Type::Armor, 10, 0},
        {"Plate Armor", "Heavy armor adds 15 DEF.", Item::Type::Armor, 15, 0},
        {"Mage Robe", "Adds 8 magical DEF.", Item::Type::Armor, 8, 0},
        {"Thief's Cloak", "Adds 6 DEF and improves evasion.", Item::Type::Armor, 6, 0},
        {"Spiked Shield", "Adds 12 DEF, reflects some damage.", Item::Type::Armor, 12, 0},
        {"Shadow Cloak", "Adds 7 DEF, grants chance to dodge.", Item::Type::Armor, 7, 0},
        {"Holy Armor", "Adds 16 DEF, resists dark attacks.", Item::Type::Armor, 16, 0},
    };
    return allItems;
}

    
